/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: nu uc
 * License Type: Evaluation
 */
package org.testis.orm.classes;

import org.orm.*;
import org.hibernate.Query;
import java.util.List;

public class T_bed_dutFactory {
    public static T_bed_dut loadT_bed_dutByORMID(int id)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_bed_dutByORMID(session, id);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut getT_bed_dutByORMID(int id)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return getT_bed_dutByORMID(session, id);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut loadT_bed_dutByORMID(int id,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_bed_dutByORMID(session, id, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut getT_bed_dutByORMID(int id,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return getT_bed_dutByORMID(session, id, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut loadT_bed_dutByORMID(PersistentSession session,
	    int id) throws PersistentException {
	try {
	    return (T_bed_dut) session.load(
		    org.testis.orm.classes.T_bed_dut.class, new Integer(
			    id));
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut getT_bed_dutByORMID(PersistentSession session,
	    int id) throws PersistentException {
	try {
	    return (T_bed_dut) session.get(
		    org.testis.orm.classes.T_bed_dut.class, new Integer(
			    id));
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut loadT_bed_dutByORMID(PersistentSession session,
	    int id, org.hibernate.LockMode lockMode) throws PersistentException {
	try {
	    return (T_bed_dut) session.load(
		    org.testis.orm.classes.T_bed_dut.class, new Integer(
			    id), lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut getT_bed_dutByORMID(PersistentSession session,
	    int id, org.hibernate.LockMode lockMode) throws PersistentException {
	try {
	    return (T_bed_dut) session.get(
		    org.testis.orm.classes.T_bed_dut.class, new Integer(
			    id), lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut[] listT_bed_dutByQuery(String condition,
	    String orderBy) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return listT_bed_dutByQuery(session, condition, orderBy);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut[] listT_bed_dutByQuery(String condition,
	    String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return listT_bed_dutByQuery(session, condition, orderBy, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut[] listT_bed_dutByQuery(PersistentSession session,
	    String condition, String orderBy) throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_bed_dut as T_bed_dut");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    List list = query.list();
	    return (T_bed_dut[]) list.toArray(new T_bed_dut[list.size()]);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut[] listT_bed_dutByQuery(PersistentSession session,
	    String condition, String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_bed_dut as T_bed_dut");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    query.setLockMode("this", lockMode);
	    List list = query.list();
	    return (T_bed_dut[]) list.toArray(new T_bed_dut[list.size()]);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut loadT_bed_dutByQuery(String condition,
	    String orderBy) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_bed_dutByQuery(session, condition, orderBy);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut loadT_bed_dutByQuery(String condition,
	    String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return loadT_bed_dutByQuery(session, condition, orderBy, lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut loadT_bed_dutByQuery(PersistentSession session,
	    String condition, String orderBy) throws PersistentException {
	T_bed_dut[] t_bed_duts = listT_bed_dutByQuery(session, condition,
		orderBy);
	if (t_bed_duts != null && t_bed_duts.length > 0)
	    return t_bed_duts[0];
	else
	    return null;
    }

    public static T_bed_dut loadT_bed_dutByQuery(PersistentSession session,
	    String condition, String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	T_bed_dut[] t_bed_duts = listT_bed_dutByQuery(session, condition,
		orderBy, lockMode);
	if (t_bed_duts != null && t_bed_duts.length > 0)
	    return t_bed_duts[0];
	else
	    return null;
    }

    public static java.util.Iterator iterateT_bed_dutByQuery(String condition,
	    String orderBy) throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return iterateT_bed_dutByQuery(session, condition, orderBy);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static java.util.Iterator iterateT_bed_dutByQuery(String condition,
	    String orderBy, org.hibernate.LockMode lockMode)
	    throws PersistentException {
	try {
	    PersistentSession session = org.testis.orm.manager.TestisDbPersistentManager
		    .instance().getSession();
	    return iterateT_bed_dutByQuery(session, condition, orderBy,
		    lockMode);
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static java.util.Iterator iterateT_bed_dutByQuery(
	    PersistentSession session, String condition, String orderBy)
	    throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_bed_dut as T_bed_dut");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    return query.iterate();
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static java.util.Iterator iterateT_bed_dutByQuery(
	    PersistentSession session, String condition, String orderBy,
	    org.hibernate.LockMode lockMode) throws PersistentException {
	StringBuffer sb = new StringBuffer(
		"From org.testis.orm.classes.T_bed_dut as T_bed_dut");
	if (condition != null)
	    sb.append(" Where ").append(condition);
	if (orderBy != null)
	    sb.append(" Order By ").append(orderBy);
	try {
	    Query query = session.createQuery(sb.toString());
	    query.setLockMode("this", lockMode);
	    return query.iterate();
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public static T_bed_dut createT_bed_dut() {
	return new org.testis.orm.classes.T_bed_dut();
    }

    public static T_bed_dut loadT_bed_dutByCriteria(
	    T_bed_dutCriteria t_bed_dutCriteria) {
	T_bed_dut[] t_bed_duts = listT_bed_dutByCriteria(t_bed_dutCriteria);
	if (t_bed_duts == null || t_bed_duts.length == 0) {
	    return null;
	}
	return t_bed_duts[0];
    }

    public static T_bed_dut[] listT_bed_dutByCriteria(
	    T_bed_dutCriteria t_bed_dutCriteria) {
	return t_bed_dutCriteria.listT_bed_dut();
    }
}
